循环遍历行并修改值

for idx,row in df.iterrows():
df.loc[idx,' 列名 ']=…#最快

df.loc[idx,[' 列名 ']=…#慢一些

还有种办法,对 row 进行赋值,最后使用 df.iloc[idx]=row,这样做可能出错。